#pragma once

#include "TinyTalkState.h"
#include "VoiceTalkStateIdle.h"
#include "VoiceTalkStateConnected.h"

namespace TalkProcess 
{


	typedef enum E_VOICETALKSTATE
	{
		VOICETALK_STATE_IDLE = 0,
		VOICETALK_STATE_TRUNK_IDLE = 1,
		VOICETALK_STATE_RINGING = 2,
		VOICETALK_STATE_CONNECTED = 3,
		VOICETALK_STATE_PLAYVOICE = 4,
		VOICETALK_STATE_WAITDIALTONE = 5,
		VOICETALK_STATE_DIALING = 6,
		VOICETALK_STATE_WAITANSWER = 7,
		VOICETALK_STATE_PENDING = 8,
		VOICETALK_STATE_WAITRINGBACKTONE =9
	}EVoiceTalkState;

	template <EVoiceTalkState StateValue,typename StateName>
	class enum2State
	{
	public:
		typedef StateName StateClass;
		enum{state = StateValue};
	};

#define VoiceTalk_State_Idle	enum2State<VOICETALK_STATE_IDLE,CVoiceTalkStateIdle>()
#define VoiceTalk_State_Connected	enum2State<VOICETALK_STATE_CONNECTED,CVoiceTalkStateConnected>()

	class CTalkStatePool
	{
	public:
		CTalkStatePool(void);
		virtual ~CTalkStatePool(void);

		template < EVoiceTalkState state, typename stateName>
		CTinyTalkState* createState(const enum2State< state,stateName >& t )
		{
			return new stateName();
		}
	};
}